package com.link2room.optimus.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * @author sqj88
 * @date 2017/10/25 10:01
 */
@Entity
@Table(name = "l2r_cancel_rule_base")
@DynamicInsert
public class L2RCancelRuleBase extends BaseEntity{
    private String ruleCode;
    private String name;
    private BigDecimal multiplyValue;
    private String descript;

    @Basic
    @Column(name = "rule_code", nullable = false, length = 32)
    public String getRuleCode() {
        return ruleCode;
    }

    public void setRuleCode(String ruleCode) {
        this.ruleCode = ruleCode;
    }

    @Basic
    @Column(name = "name", nullable = false, length = 64)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "multiply_value", nullable = true, precision = 2)
    public BigDecimal getMultiplyValue() {
        return multiplyValue;
    }

    public void setMultiplyValue(BigDecimal multiplyValue) {
        this.multiplyValue = multiplyValue;
    }

    @Basic
    @Column(name = "descript", nullable = true, length = 255)
    public String getDescript() {
        return descript;
    }

    public void setDescript(String descript) {
        this.descript = descript;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        L2RCancelRuleBase that = (L2RCancelRuleBase) o;

        if (ruleCode != null ? !ruleCode.equals(that.ruleCode) : that.ruleCode != null) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (multiplyValue != null ? !multiplyValue.equals(that.multiplyValue) : that.multiplyValue != null)
            return false;
        if (descript != null ? !descript.equals(that.descript) : that.descript != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = ruleCode != null ? ruleCode.hashCode() : 0;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (multiplyValue != null ? multiplyValue.hashCode() : 0);
        result = 31 * result + (descript != null ? descript.hashCode() : 0);
        return result;
    }
}
